use sea_orm::{FromQueryResult, prelude::Date};
use serde::Serialize;
use serde_with::{serde_as, DisplayFromStr};

// 使用 FromQueryResult ，字段必须公开
/// 部门下的员工
#[serde_as]
#[derive(Serialize, FromQueryResult)]
pub struct DptPersonnel {
    #[serde_as(as = "DisplayFromStr")]
    pub id: i64,
    pub sex: String,
    pub name: String,
    pub position: String,
}

/// 岗位下的员工
#[serde_as]
#[derive(Serialize, FromQueryResult)]
pub struct PosPersonnel {
    #[serde_as(as = "DisplayFromStr")]
    pub id: i64,
    pub sex: String,
    pub name: String,
}

/// 已经离职的员工
#[serde_as]
#[derive(Serialize, FromQueryResult)]
pub struct ResPersonnel {
    #[serde_as(as = "DisplayFromStr")]
    pub id: i64,
    pub name: String,
    pub department: String,
    pub position: String,
    pub kind: String,
    pub resign_date: Date,
}
